<template>
  <u-modal
    @close="onClose"
    @confirm="onConfirm"
    :show="show"
    :title="title"
    :confirmText="'我知道了'"
  >
    <iframe class="frame" :src="src" frameborder="0"></iframe>
  </u-modal>
</template>
<script>
export default {
  props: {
    type: {
      type: String | Number,
      default: 1,
    },
    show: {
      type: Boolean,
      default: false,
    },
  },
  data() {
    return {
      title: "用户协议",
      src: "http://quickplaylet.youmanvideo.com/agency/yhxy.html",
      map: {
        1: {
          name: "用户协议",
          src: "http://quickplaylet.youmanvideo.com/agency/yhxy.html",
        },
        2: {
          name: "隐私政策",
          src: "http://quickplaylet.youmanvideo.com/agency/yszc.html",
        },
        3: {
          name: "收集个人信息明示清单",
          src: "http://quickplaylet.youmanvideo.com/agency/sjxx.html",
        },
        4: {
          name: "个人信息第三方共享清单",
          src: "http://quickplaylet.youmanvideo.com/agency/gxqd.html",
        },
      },
    };
  },
  watch: {
    show(val) {
      if (val) {
        this.title = this.map[this.type].name;
        this.src = this.map[this.type].src;
      }
    },
  },
  mounted() {},
  methods: {
    onClose() {
      this.$emit("close");
    },
    onConfirm(){
        this.$emit("confirm");
    }
  },
};
</script>
<style lang="less" scoped>
    .frame{
        height: 800rpx;
    }
</style>
